<?php $__env->startSection('title','新增专家页'); ?>
<?php $__env->startSection('content'); ?>
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="col-md-12" id="content">

            <div class="app_content_div" id="app_content_div_301Index">
                <h3>新增专家</h3>
            </div>
            <form class="form-horizontal">
                <?php echo csrf_field(); ?>
                <div class="form-group">
                    <label for="name" class="col-sm-2 control-label"><span style="color:red;">*</span>姓名</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="name" name="name">
                    </div>
                </div>
                <div class="form-group">
                    <label for="upload_file" class="col-sm-2 control-label"><span style="color:red;">*</span>头像</label>
                    <div class="col-sm-10">
                        <input type="file" name="thumb" id="thumb" onchange="previewImage()" >
                        <div id="image-container"></div>



                    </div>
                </div>


                <div class="form-group">
                    <label for="department" class="col-sm-2 control-label"><span style="color:red;">*</span>科室</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="keshi" name="keshi">
                    </div>
                </div>
                <div class="form-group">
                    <label for="title" class="col-sm-2 control-label"><span style="color:red;">*</span>职称</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="zhicheng" name="zhicheng" >
                    </div>
                </div>
                <div class="form-group">
                    <label for="postion" class="col-sm-2 control-label"><span style="color:red;">*</span>职务</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="zhiwu" name="zhiwu" >
                    </div>
                </div>
                <div class="form-group">
                    <label for="hospital" class="col-sm-2 control-label"><span style="color:red;">*</span>医院</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" id="yiyuan" name="yiyuan" >
                    </div>
                </div>
                <div class="form-group">
                    <label for="hospital" class="col-sm-2 control-label"><span style="color:red;">*</span>简介</label>
                    <div class="col-sm-10">

                                                <script id="jianli"  type="text/plain"></script>




                    </div>
                </div>
                                <script type="text/javascript">
                                    var ue1 = UE.getEditor('jianli',{
                                        elementPathEnabled: false,
                                        saveInterval: 5000
                                    });
                                </script>

                <div class="form-group">
                    <label for="hospital" class="col-sm-2 control-label"><span style="color:red;">*</span>接受教育</label>
                    <div class="col-sm-10">

                                                <script id="edu"  type="text/plain" ></script>




                    </div>
                </div>
                                <script type="text/javascript">
                                    var ue2 = UE.getEditor('edu',{
                                        elementPathEnabled: false,
                                        saveInterval: 5000
                                    });
                                </script>

                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="button" onclick="add()" class="btn btn-default">确定</button>
                    </div>
                </div>
            </form>




        </div>
    </div>
    <script>
        function add() {
            var name = $('#name').val();
            var keshi = $('#keshi').val();
            var zhicheng = $('#zhicheng').val();
            var zhiwu = $('#zhiwu').val();
            var yiyuan = $('#yiyuan').val();
            // var introduce = $('#introduce').val();
            // var education = $('#education').val();
            let introduce=ue1.getContentTxt();
             let education=ue2.getContentTxt();
            var _token = "<?php echo e(csrf_token()); ?>";
            $.ajaxFileUpload({
                url: '/adm/expert/add',
                type: 'post',
                fileElementId:'thumb',
                dataType: 'json',
                data: {
                    'name': name, 'keshi': keshi,
                    'zhicheng': zhicheng, 'yiyuan': yiyuan,
                    'introduce': introduce, 'zhiwu': zhiwu, 'education': education,
                    '_token': _token
                },
                //     $.post('/adm/expertlist',
                //         {'name':name,'keshi':keshi,
                //         'zhicheng':zhicheng,
                //         'zhiwu':zhiwu,"yiyuan":yiyuan,'jianli':jianli,
                //         "jieshoujiaoyu":jieshoujiaoyu,'_token':_token },
                success:function (data) {
                    if (data.success) {
                        alert("成功提交");
                        location.href = '/adm/expertlist';
                    } else {
                        alert(data.msg);
                    }
                }


            });
        }
    </script>
    <script>
    function previewImage() {
    var file = document.getElementById("thumb").files[0];
    var reader = new FileReader();
    reader.onload = function(e) {
    var img = document.createElement("img");
    img.src = e.target.result;
        img.width = 200; // 设置宽度为200像素
        img.height = 200; // 设置高度为200像素
    document.getElementById('image-container').appendChild(img);
    }
    reader.readAsDataURL(file);
    }

    </script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('admin.layout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\Users\xinyi\Desktop\510\resources\views/admin/expert-create.blade.php ENDPATH**/ ?>